import VideoCard from "../components/videoCard";
import { useState,useEffect } from "react";
import { XMLParser } from "fast-xml-parser";

const Home = () =>{
    const [videoList,setVideoList] = useState([])
    useEffect(()=>{
        window.go.main.App
        .HttpGet("https://api.zuidapi.com/api.php/provide/vod/from/zuidam3u8/at/xml/?ac=videolist&pg=1")
        .then(res =>{
            const parse = new XMLParser();
            let obj = parse.parse(res);
            console.log(obj)
            setVideoList(obj.rss.list.video)
        }).catch(err => console.log(err))
        
        
    },[])
    return(
        <div className="home-content">{videoList.map((video)=>(
            <VideoCard key={video.id} pic={video.pic} name={video.name}/>
        ))}</div>
    )
}
export default Home;